//
//  UCPickerViewSetting.swift
//  UICreate
//
//  Created by 范晓鑫 on 2021/10/27.
//

import UIKit

extension UCSetting where TargetType: UIPickerView {
    ///dataSource
    public static func source(_ dataSource:UIPickerViewDataSource?) -> UCSetting<TargetType> {
        return .init(action: { (target) in
            target.dataSource = dataSource
        })
    }
    ///delegate
    public static func delegate(_ delegate:UIPickerViewDelegate?) -> UCSetting<TargetType> {
        return .init(action: { (target) in
            target.delegate = delegate
        })
    }
    ///selectRow(_ row: Int, inComponent component: Int, animated: Bool) \
    public static func select(_ row: Int, in component: Int) -> UCSetting<TargetType> {
        return .init(action: { (target) in
            target.selectRow(row, inComponent: component, animated: false)
        })
    }
}
